Help:Link

From PyroGuide

Jump to: navigation, search

Template:H:h

Hyperlinks allow users to click between pages. For some basic information about using hyperlinks, see Help:Editing#Links, URLs. There are three general types of hyperlinks recognized by MediaWiki, each with associated CSS formatting to distinguish them.

Contents

[edit] Wikilinks

Wikilinks (internal links) allow pages within a project to be linked together. These links are in the form [[article name|link name]], where the link name is optional. For example, [[Main Page]] becomes Main Page, and [[Main Page|index]] becomes index. Links with parameters (the link name) are said to be "piped" because of the pipe symbol used ('|').

MediaWiki automatically checks if the target of a wikilink exists. If the page doesn't exist, the link is assigned the class "new". Such wikilinks are nicknamed "red links" because they are coloured red in the default stylesheet on a default installation of MediaWiki. Red links are useful in determining the current status of the page (created or not created), create incoming links to a future page, facilitates and incites page creation. As of MediaWiki 1.5, red links lead to the editing screen.

Note that the image, category, and interlanguage syntax are the same as the wikilink syntax. Counterintuitively, attempting to link normally to an image will place that image on the page. This can be prevented by prefixing a colon, which escapes the specific syntax. For example, [[:Category:Help]], [[:fr:Help:Link]], and [[:Image:Mediawiki.png]].

[edit] Stub feature

A wikilink to an existing page will be in class 'stub' if the page is in the main namespace, it is not a redirect, and it is below the "threshold for stub display" set in the user's preferences.

This allows users to immediately identify links to very short pages that probably need to be expanded. Alternately, a user may set a very high threshold to achieve any of the following:

  • Allow them to identify very large pages (pages without the "stub" formatting). However, the possible inclusion of templates and images makes this an unreliable method of identifying large pages; size is determined by the amount of wiki text, not the size of the composite page.
  • Determine at a glance whether a link leads to the main namespace or not. However, this does not take into account redirects to the main namespace (even if the redirect itself is in the main namespace).
  • Identify redirects in an article for clean-up work such as bypassing redirects.

However, section linking to a "stub" does not work. Although this is normally a minor issue, this may cause problems with users who set a very high threshold.

[edit] Interwiki links

Interwiki links allow pages on different wikis to be linked together, as long as the other wiki is on the interwiki map. These links have the associated CSS class "extiw". These are in the same form as wikilinks above, but take a prefix which sets the wiki. For example, [[Wikipedia:Main Page]] links to Wikipedia's main page. The prefix can be hidden using the same piped syntax as wikilinks.

[edit] Interwiki links to the same project

Although interwiki links can be used to point to a wiki from itself, this is not generally recommended. MediaWiki does not detect whether or not the target page of an interwiki list exists, so there is no special formatting and the link is always to the view page. Further, MediaWiki does not check if the page is linking to itself. A self wikilink is bolded (like Help:Link), whereas a self interwiki link is normal (m:Help:Link).

Pros:

  • A copy of the wikitext on a sister project may still point to the same page. Sometimes two prefixes are needed for that purpose, e.g. w:de:a.

[edit] External links

External links use absolute URLs to link directly to any page on the Internet. These links have the associated CSS class "external". External links are in the form [http://www.example.org link name] (resulting in link name), with the link name separated from the URL by a space. Links without link names will be numbered: [http://www.example.org] becomes [1]. Links with no square brackets will be displayed in their entirety: http://www.example.org .

See URLs in external links for more detail information.

[edit] External links to the same project

External links are often used to use special URL parameters in links. This allows links directly to the edit history of a page, to a page in edit view, a diff of two versions, et cetera. They can also be used to create a navigational image.

However, the use of external links to link to a normal page on the same project is not recommended. These links benefit from none of the features of a wikilink, and may break the web of links when the content is exported to another domain.

[edit] Section linking

Links in the form [[#anchor_name]] will link to any anchor named "anchor_name" on the page. This may be either a heading named "anchor_name", or an arbitrary position. [[#top]] is a reserved name that links to the top of a page. It is possible to create an arbitrary anchor name using the HTML code <span id="anchor_name"></span>.

Anchor links can also be appended to any type of link; for more information, see Help:Section#Section_linking.

[edit] Problems with page name conversion

Note that if the page name is automatically converted (for example, from "/wiki/main Page" to "/wiki/Main Page"), the section link will still work but will disappear from the address bar. As a consequence, this will make it more difficult to bookmark the section itself. This is not applicable for wikilinks, because the conversions have already taken place on Preview or Save of the referring page.

For example, consider http://en.wikipedia.org/wiki/Wikipedia:how_to_edit_a_page#Links_and_URLs. In this case, the anchor will part of the address will disappear because the "how" will be converted to "How".

[edit] Anchors that go nowhere

By adding [[{{NAMESPACE}}:{{PAGENAME}}#|False anchor]] to the page, you can create a dummy link that just refreshes the page.

[edit] Redirects with section links

A redirect to a page section does not go to the section. However, one can add the section anyway as a clarification, and it will work if the redirect is manually clicked from the redirect page. However, links with a section to a redirect will lead to the section on the redirect's page.

[edit] Subpage feature

MediaWiki has a subpage feature, although activation depends on project and namespace. A parent page is separated from subpages with a forward slash: [[Parent/subpage]]. Subpages can have their own subpages. If the page is in a namespace where subpages are not activated, it is considered as a single page titled "Page/subpage".

At the top of the subpage body links to parent pages are shown automatically, without any corresponding wikitext. The link shows up even if the page "Subpage" does not exist, provided that the page "Parent" exists. Like most letters of a page name, the first letter after the slash is case-sensitive; "/subpage" and /"Subpage" are different pages.

What links here and Related changes ignore these automatic links.

[edit] Syntax

Inside a subpage hierarchy the following links can be used:

  • [[../]] links to the parent of the current subpage (ex: [[Page/Subpage]] to [[Page]]).
  • [[../Sibling]] links to a sibling of the current subpage. (ex: [[Page/Subpage]] to [[Page/Sibling]]).
  • [[/Subpage]] links to a subpage (ex: [[Parent]] to [[Parent/Subpage]]).

See also w:Wikipedia:Subpages, and the example pages m:Link/a/b and m:Help:Link/a/b. For the latter the subpage feature does not work because of the namespace.

[edit] User space

Subpages of a user page ([[User:Username/Subpage]]) are considered to be in that user's "user space". Rules are often relaxed in a user's own subpages, whereas they are typically tightened for a user editing another user's subpages.

[edit] Subpage activation

Wikipedia has this feature activated in all talk namespaces and the user and project namespace. The Meta-Wiki also has it in the main namespace. The default is set in DefaultSettings.php[2]. As of revision 1.21, the following namespaces have it activated by default: Special, Main talk, User and User_talk, Meta_talk, and Image_talk. Settings per project are changed in LocalSettings.php[3].

[edit] Miscellaneous

[edit] Linking to a page with images

It is possible to use images as links to other pages. For more information, see use an image as a link to a page.

[edit] "Hover box" on links

On some browsers, holding the cursor over link will show a hover box containing the text of the link's HTML title attribute. MediaWiki sets this to the target page name (without the possible section indication) if it's a wikilink, the page name with prefix if it's an interwiki link, and the URL if it's an external link.

This can be switched off in the user preferences. The browser may also show similar info, but with the possible section indication, in the address bar.

For these effects a piped link is useful even if it not followed; for example, for displaying the meaning of an acronym (SUL) or any other remark. It is possible to produce a hover box without a link.

[edit] Disallowed characters

In internal and interwiki link style, a plus sign in a page name is not allowed, the HTML and hence the rendered page just shows the wikitext, e.g. a+b. In external link style a plus sign in the URL is retained. It is often equivalent with a space. See also below.

In accordance with the rules explained in Help:Page name, conversions are automatically made to non-literal characters in wiki and interwiki links. For example, "[[Help:Page%20name]]" becomes "Help:Page name". However, the opposite is true for external links; literal characters and converted into non-literal characters. For example, most browsers will convert ".../wiki/!" to ".../wiki/%21".

A code like %70 in a redirect disables it, although the link works from the redirect page. For a redirect that works, the redirect page shows the canonical form of the target, unlike its preview page, which renders the link in the usual way.

[edit] Special pipe syntax

Using an empty pipe syntax on wiki and interwiki links will hide interwiki prefixes and parentheses. For example, [[w:Mercury (planet)|]] becomes Mercury. This pipe syntax should only be used where the unqualified reference is not ambiguous, such as in an article about the solar system.

[edit] Additional effects of links

  • Related changes
  • Backlinks
  • Date format
  • Using a wikilink with a space after the pipe syntac ([[Main page| ]]) hides the link for normal view (" "), but activates the "what links here" feature.

[edit] See also

Template:H:f

Personal tools
pyroguide forum
pyroguide sponsors
pyroguide visitors